package com.jprocms.module.cms.dal.mysql.sensitivetask;

import com.jpro.framework.common.pojo.PageResult;
import com.jpro.framework.mybatis.core.mapper.BaseMapperX;
import com.jpro.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.jprocms.module.cms.controller.admin.sensitivetask.vo.TaskSensitiveResultListReqVO;
import com.jprocms.module.cms.controller.admin.sensitivetask.vo.TaskSensitiveResultPageReqVO;
import com.jprocms.module.cms.dal.dataobject.tasksensitiveresult.TaskSensitiveResultDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 敏感词扫描任务结果 Mapper
 *
 * @author jprocms
 */
@Mapper
public interface TaskSensitiveResultMapper extends BaseMapperX<TaskSensitiveResultDO> {

    default PageResult<TaskSensitiveResultDO> selectPage(TaskSensitiveResultPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TaskSensitiveResultDO>()
                .eqIfPresent(TaskSensitiveResultDO::getSiteId, reqVO.getSiteId())
                .eqIfPresent(TaskSensitiveResultDO::getTaskId, reqVO.getTaskId())
                .eqIfPresent(TaskSensitiveResultDO::getContentId, reqVO.getContentId())
                .eqIfPresent(TaskSensitiveResultDO::getSensitiveWord, reqVO.getSensitiveWord())
                .betweenIfPresent(TaskSensitiveResultDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(TaskSensitiveResultDO::getId));
    }

    default List<TaskSensitiveResultDO> selectList(TaskSensitiveResultListReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<TaskSensitiveResultDO>()
                .eqIfPresent(TaskSensitiveResultDO::getSiteId, reqVO.getSiteId())
                .eqIfPresent(TaskSensitiveResultDO::getContentId, reqVO.getContentId())
                .eqIfPresent(TaskSensitiveResultDO::getSensitiveWord, reqVO.getSensitiveWord())
                .betweenIfPresent(TaskSensitiveResultDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(TaskSensitiveResultDO::getId));
    }

}
